package cn.hxy.bladeframework;

import com.blade.Blade;
import com.blade.security.web.csrf.CsrfMiddleware;

//import cn.hxy.bladeframework.util.middleware.BasicAuthMiddleware;

/**
 * @author eric
 * @description:
 * @date 1/4/20 1:48 PM
 */
public class Application {
    public static void main(String[] args) {
        // blade-framework启动
//        Blade.of().start(Application.class, args);
//        Blade.of().get("/", ctx -> ctx.text("Hello World!")).start(Application.class, args);
        // 设置跨域
        Blade.of().use(new CsrfMiddleware()).get("/", ctx -> ctx.text("Hello World!")).start(Application.class, args);

        // 下面是中间件演示，但是没有折腾成功
//        AuthOption authOption = new AuthOption();
//        authOption.addUser("eric", "password");
//        Blade.of().use(new BasicAuthMiddleware(authOption)).get("/", ctx -> ctx.text("Hello World!")).start(Application.class, args);
    }

}
